#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include<QTimer>
#include <QMouseEvent>
#include <map.h>
#include <heroplane.h>
#include "bullet.h"
#include "enemyplane.h"
#include "bomb.h"
#include <pause.h>
#include <lives.h>
#include "button.h"

QT_BEGIN_NAMESPACE


namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = nullptr);
    ~Widget();
private:
    Ui::Widget *ui;
    void initscene();
    void playGame();
    void updatePosition();
    void paintEvent(QPaintEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void enemyToscene();
    void collisionDetection();

    EnemyPlane m_enemys[ENEMY_NUM];
    int m_recorder;
    map m_map;
    heroplane m_hero;
    QTimer m_Timer;
    Bomb m_bombs[BOMBNUM];
    int m_score;
    bool m_pause;
    Pause m_Pause;
    void mousePressEvent(QMouseEvent *);
    Lives m_lives;
    bool m_gameover;
    void restart();
    Button restartbutton;
};
#endif // WIDGET_H
